<?php

namespace app\http\middleware;


class Check
{
    public function handle($request, \Closure $next)
    {
        //在这个中间件中我们判断当前请求的name参数等于think的时候进行重定向处理
        if ($request->param('name') == 'think') {
            return redirect('index/think');
        }

        //拦截并修改参数
        if ($request->param('name') == 'welcome') {
            $request->name = "<br/><br/>this is a param come from middleware";
        }

        return $next($request);
    }
}